﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace CRM.BLL
{
    public class SysLogInfo
    {
        /// <summary>
        /// 写系统日志
        /// </summary>
        /// <param name="ModelLog"></param>
        /// <returns></returns>
        public static void EditLogInfo(Model.T_SysLogInfo ModelLog)
        {
            try
            {
                SqlParameter[] strPar = {
					new SqlParameter("@T_LogNote", SqlDbType.Text),
					new SqlParameter("@T_LogIP", SqlDbType.Char,100),
					new SqlParameter("@T_Remark", SqlDbType.NChar,50)};
                strPar[0].Value = ModelLog.T_LogNote;
                strPar[1].Value = ModelLog.T_LogIP;
                strPar[2].Value = ModelLog.T_Remark;

                DBUtility.SqlHelper.ExecuteNonQuery(DBUtility.SqlHelper.sqlConnectionString, CommandType.StoredProcedure, "EditLogInfo", strPar);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        /// <summary>
        /// 删除指定/所有日志信息
        /// </summary>
        /// <param name="strLogID"></param>
        /// <returns></returns>
        public static bool DelLogInfo(string strLogID)
        {
            try
            {SqlParameter[] strPar = {
					new SqlParameter("@T_LogID", SqlDbType.Char,1000)};
                strPar[0].Value = strLogID;
                return (DBUtility.SqlHelper.ExecuteNonQuery(DBUtility.SqlHelper.sqlConnectionString, CommandType.StoredProcedure, "DelLogInfo", strPar) > 0) ? true : false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
